import http from '@/utils/http'

const BASE_URL = '/jobfair/resume'

export interface ResumeResp {
  id: string
  studentId: string
  fileId: string
  createTime: string
  name: string
  createUserString: string
  updateUserString: string
}
export interface ResumeDetailResp {
  id: string
  studentId: string
  fileId: string
  createTime: string
  updateTime: string
  createUser: string
  updateUser: string
  name: string
  createUserString: string
  updateUserString: string
}
export interface ResumeQuery {
  studentId: string
  name: string
  sort: Array<string>
}
export interface ResumePageQuery extends ResumeQuery, PageQuery {}

/** @desc 查询简历管理列表 */
export function listResume(query: ResumePageQuery) {
  return http.get<PageRes<ResumeResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询简历管理详情 */
export function getResume(id: string) {
  return http.get<ResumeDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 学生上传简历 */
export function addResume(data: FormData) {
  return http.post(`${BASE_URL}/uploadFile`, data)
}

/** @desc 修改简历管理 */
export function updateResume(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除简历管理 */
export function deleteResume(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 根据学生ID查询简历 */
export function listResumeByStudentId(studentId: string) {
  return http.get<any>(`${BASE_URL}/list/${studentId}`)
}